package de.schmidke.palmreader;

import java.io.File;

public class Process {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		String user = null;
		String pwd = null;
		File adrfile = null;
		for (int i = 0; i < args.length; i++) {
			String s = args[i];
			if ("-u".equals(s)) {
				user = args[++i];
			} else if ("-p".equals(s)) {
				pwd = args[++i];
			} else if ("-a".equals(s)) {
				adrfile = new File(args[++i]);
			}
		}
		args = null; // let password gc early
		try {
			GoogleConnect gc = new GoogleConnect(user, pwd);
			pwd = null;
			if (adrfile != null) {
				AddressDat ad = new PalmReader().readAddressDat(adrfile);
				gc.run(ad);
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

}
